package com.wll.ec.core.app;

import android.content.Context;
import android.os.Handler;

import java.util.HashMap;

/**
 * Created by detachment on 2020/3/14
 */
public class Ec {

    public static Configurator init(Context context) {
        getConfigurations().put(ConfigType.APPLICATION_CONTEXT, context.getApplicationContext());
        return getConfigurator();
    }

    public static Configurator getConfigurator() {
        return Configurator.getInstance();
    }

    public static <T> T getConfiguration(Object key) {
        return getConfigurator().getConfiguration(key);
    }

    public static HashMap<Object, Object> getConfigurations() {
        return getConfigurator().getEcConfigs();
    }

    public static Handler getHandler() {
        return getConfiguration(ConfigType.HANDLER);
    }

    public static Context getApplicationContext() {
        return (Context) getConfiguration(ConfigType.APPLICATION_CONTEXT);
    }

}
